package com.haochang.chunkvod.controller.adapter.hostess;

import java.util.List;

import com.haochang.base.BaseTextView;
import com.haochang.chunkvod.R;
import com.haochang.chunkvod.controller.adapter.base.BaseAdapterHelper;
import com.haochang.chunkvod.controller.adapter.base.QuickAdapter;
import com.haochang.chunkvod.model.hostess.HostessInfo;

import android.content.Context;
import android.view.View;

/**
 * 咨客预定信息 适配器
 */
public class ReserveAdapter extends QuickAdapter {
    private Context mContext;

    public ReserveAdapter(Context context, int layoutResId, List data) {
        super(context, layoutResId, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseAdapterHelper helper, final Object object) {
        final HostessInfo item = (HostessInfo) object;
        final BaseTextView tv_count = helper.getView(R.id.tv_right);
		final View spaceLineTop = helper.getView(R.id.spaceLineTop);
        helper.setText(R.id.tv_left, item.getStart_time());
        helper.setText(R.id.tv_right, item.getReserveNum());
        if(helper.getPosition()==0||helper.getPosition()==1){
            spaceLineTop.setVisibility(View.VISIBLE);
        }else {
            spaceLineTop.setVisibility(View.GONE);
        }
        try {
            if (Integer.parseInt(item.getReserveNum()) >= 10) {
                tv_count.setTextColor(mContext.getResources().getColor(R.color.red));
            } else {
                tv_count.setTextColor(mContext.getResources().getColor(R.color.color_737373));
            }
        } catch (Exception e) {
            tv_count.setTextColor(mContext.getResources().getColor(R.color.color_737373));
        }
    }
}
